var ns, app, dialog,slide, toast;
var app = new Vue({
    el: '#app',
    data: {
        ID:0,
        form:{},
        imglist:[],
        is_rotated: false,
        cache_index: 0,
    },
    methods: {
        getdata:function(){
            var that=this;
            var options={};
            options.ID=that.ID;
            options.action = "gethouseservicedetail";
            ns.post(options, function (succeed, data, err){
                if(succeed){
                    that.form=data.data;
                    that.imglist=data.imglist;
                    setTimeout(function() {
                        that.slider_work();
                    }, 200);

                }

            })
        },
        slider_work: function() {
            var that = this;
            if (that.is_rotated) {
                return;
            }
            that.is_rotated = true;
            slide = new auiSlide({
                container: document.getElementById("aui-slide"),
                "height": 208,
                "speed": 500,
                "autoPlay": 5000, //自动播放
                "loop": true,
                "pageShow": true,
                "pageStyle": 'dot',
                'dotPosition': 'top'
            })
        },
        image_cache: function() {
            var that = this;
            var item = that.form.ImgList[that.cache_index];
            api.imageCache({
                url: item.AttachedFilePath,
                thumbnail: false
            }, function(ret, err) {
                that.cache_index++;
                if (ret.status) {
                    item.cacheurl = ret.url;
                }
                if (that.cache_index <= that.form.ImgList.length - 1) {
                    that.image_cache();
                } else {
                    setTimeout(function() {
                        that.slider_work();
                    }, 200)
                }
            });
        },
        
    }
});
apiready = function () {
    api.parseTapmode();
    ns = window.Foresight.Util;
    dialog = new auiDialog();
    toast = new auiToast();
    app.ID = api.pageParam.ID;
    app.getdata();

};
